package com.xiaoxian.usercenter.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig {
    public Docket Api() {
        // 使用Swagger2语法
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("瓦友网")
                        .description("# 这是一段描述")
                        .termsOfServiceUrl("......")
                        .contact(new Contact("张三", "http:localhost:8099/demo", "XX@qq.com"))
                        .license("...")
                        .licenseUrl("......")
                        .version("1.0")
                        .build())
                .groupName("1.0版本")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.xiaoxian.usercenter.controllere"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
}


